<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Priithon.wxAsyncDispatcher</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Priithon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/priithon">Priithon</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Priithon-module.html">Package&nbsp;Priithon</a> ::
        Module&nbsp;wxAsyncDispatcher
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Priithon.wxAsyncDispatcher-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module wxAsyncDispatcher</h1><p class="nomargin-top"><span class="codelink"><a href="Priithon.wxAsyncDispatcher-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">
Priithon
# modified version of http://wiki.wxpython.org/AsynchronousSockets 
#                     by Josiah Carlson
#
# seb: what does this mean:
             # remember to validate any possible
             # socket objects recieved from the GUI,
             # they could already be closed
       # this is somehow related to the **kwarg sock=self - but otherwise unused

</pre>

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Priithon.wxAsyncDispatcher.DispatcherConnection-class.html" class="summary-name">DispatcherConnection</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Priithon.wxAsyncDispatcher.LineEchoConnection-class.html" class="summary-name">LineEchoConnection</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Priithon.wxAsyncDispatcher.DispatcherServer-class.html" class="summary-name">DispatcherServer</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Priithon.wxAsyncDispatcher.MainWindow-class.html" class="summary-name">MainWindow</a>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="loop"></a><span class="summary-sig-name">loop</span>()</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.wxAsyncDispatcher-pysrc.html#loop">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.wxAsyncDispatcher-module.html#socketServerStart" class="summary-sig-name">socketServerStart</a>(<span class="summary-sig-arg">onRead</span>,
        <span class="summary-sig-arg">linewise</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">logFcn</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">port</span>=<span class="summary-sig-default">4711</span>,
        <span class="summary-sig-arg">host</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">wxEvtFrame</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">threaded</span>=<span class="summary-sig-default">False</span>)</span><br />
      install a server to listen on given `port` on given `host`</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.wxAsyncDispatcher-pysrc.html#socketServerStart">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="socketServer_demo"></a><span class="summary-sig-name">socketServer_demo</span>(<span class="summary-sig-arg">port</span>=<span class="summary-sig-default">4711</span>,
        <span class="summary-sig-arg">host</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">localhost</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">threaded</span>=<span class="summary-sig-default">False</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.wxAsyncDispatcher-pysrc.html#socketServer_demo">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="socketServer_clearAll"></a><span class="summary-sig-name">socketServer_clearAll</span>(<span class="summary-sig-arg">closeAllSockets</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">stopAllPolling</span>=<span class="summary-sig-default">True</span>)</span><br />
      use this to stop all prior started servers</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.wxAsyncDispatcher-pysrc.html#socketServer_clearAll">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="to_network"></a><span class="summary-name">to_network</span> = <code title="Queue.Queue()">Queue.Queue()</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Priithon.wxAsyncDispatcher-module.html#_pollers" class="summary-name" onclick="show_private();">_pollers</a> = <code title="[]"><code class="variable-group">[</code><code class="variable-group">]</code></code><br />
      class CustomConnection(DispatcherConnection):
    #inc_buffer = ''
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="EVT_LOG_EVENT"></a><span class="summary-name">EVT_LOG_EVENT</span> = <code title="&lt;wx._core.PyEventBinder object at 0x80cce50&gt;">&lt;wx._core.PyEventBinder object at 0x80cce50&gt;</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="socketServerStart"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">socketServerStart</span>(<span class="sig-arg">onRead</span>,
        <span class="sig-arg">linewise</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">logFcn</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">port</span>=<span class="sig-default">4711</span>,
        <span class="sig-arg">host</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">wxEvtFrame</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">threaded</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.wxAsyncDispatcher-pysrc.html#socketServerStart">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

    install a server to listen on given `port` on given `host`

    onRead is a handler function that is being called with a 
    asyncore.dispatcher_with_send object as argument (`asynDisp`)
    (its type is really a DispatcherConnection, which is derived of that)

    if `linewise`: `onRead` is called for each completed line
                   an `line` is an extra first(!) argument
                   ('
' is truncated)
                   (`asynDisp.recv(512)` is called for you as needed!)
    otherwise, `onRead` has to do the `asynDisp`.recv(512) calls itself

    `host`='' means &quot;all IPs of local host&quot; (127.0.0.1 + external IP(s))

    `logFcn`: if None no logging done, otherwise `logFcn` called for each 
                                log-print with string message as argument

    if `threaded` is False,
       a timer event is connected to `wxEvtFrame`
    `wxEvtFrame` None means, find and use &quot;first&quot; toplevel parent
    

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-VariablesDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="_pollers"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">_pollers</h3>
  <pre class="literalblock">

class CustomConnection(DispatcherConnection):
    #inc_buffer = ''

    # def __init__(self, connection, logFcn, handle_read):
    #     self.hr = handle_read
    #     DispatcherConnection.__init__(self, connection, logFcn)
    def handle_read(self):
        self.hr(self)
        # self.inc_buffer += self.recv(512)
        # while '
' in self.inc_buffer:
        #     snd, self.inc_buffer = self.inc_buffer.split('
', 1)
        #     snd += '
'
        #     self.log(&quot;Line from %s: %r&quot;%(self.addr, snd))
        #     self.send(snd)

</pre>
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
<code class="variable-group">[</code><code class="variable-group">]</code>
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Priithon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/priithon">Priithon</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Nov 22 14:59:33 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
